# import tkinter as tk

# window = tk.Tk()
# window.title('hello thinter')
# height= window.winfo_screenheight()
# width= window.winfo_screenwidth()
# window.geometry('400x300+%d+%d'%((width-400)/2,(height-300)/2))

# message = tk.Message(window, text="这是一则消息", width=100)
# message.pack()

# window.mainloop()


import tkinter as tk
from tkinter import messagebox


def _showwarning():
    re = tk.messagebox.showwarning(title="tkinter demo", message="是否提交？")
    # 点击确认re=True 点击取消 re = False
    if re:
        print("点击确认执行的函数")
    else:
        print("点击取消执行的函数")


window = tk.Tk()
window.title('hello thinter')
height = window.winfo_screenheight()
width = window.winfo_screenwidth()
window.geometry('400x300+%d+%d' % ((width - 400) / 2, (height - 300) / 2))
tk.Button(window, text="提交", command=_showwarning).pack()
window.mainloop()